const defaultKey = 'eveAdminToken';
const userInfoKey = 'LoginUserInfo';
function set(obj) {
  localStorage.setItem(defaultKey, obj.token);
  localStorage.setItem(userInfoKey, JSON.stringify(obj))
}

function logout() {
  localStorage.removeItem(defaultKey);
  localStorage.removeItem(userInfoKey);
}

function get() {
  return localStorage.getItem(defaultKey);
}

function bool() {
  return localStorage.getItem(defaultKey) ? true : false;
}

function getUserInfo(){
  return JSON.parse(localStorage.getItem(userInfoKey));
}

export { set, logout, get, bool, getUserInfo}